package cn.wwk.canal.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 测试高级特性
 *
 * @author wwk*/
@Component
@Slf4j
public class CanalDataListener {

    @RabbitListener(bindings = @QueueBinding(
        value = @Queue(name = "canal_queue"),
        exchange = @Exchange(name = "canal_exchange", type = ExchangeTypes.DIRECT),
        key = "canal_key"
    ))
    public void handleDataExchange(String msg){
        System.out.println("消费者接收到canal_queue的消息：【" + msg + "】");
    }
}
